<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('production_order', function (Blueprint $table) {
            $table->id()->unique()->comment('自增ID');
$table->integer('fid')->comment('单据内码');
$table->string('fbillno', 200)->unique()->comment('单据编号');
$table->string('fprdorgid', 20)->comment('生产组织');
$table->string('fmaterialid', 100)->comment('产品SKU（物料编码）');
$table->string('fmaterialname', 200)->comment('产品名称（物料名称）');
$table->string('fmaterialmodel', 200)->nullable()->comment('规格');
$table->string('fmodel', 100)->nullable()->comment('型号');
$table->string('funitid', 10)->comment('单位');
$table->integer('fqty')->comment('数量');
$table->string('fbomid', 50)->nullable()->comment('BOM版本');
$table->string('fmotype', 10)->comment('生产订单类型');
$table->string('fmobillno', 200)->comment('生产订单编号');
$table->integer('fmoentryseq')->comment('生产订单行号');
$table->string('fmoentrystatus', 10)->comment('生产订单状态');
$table->string('fdocumentstatus', 10)->comment('单据状态');
$table->dateTime('fplannedstarttime')->comment('计划开工时间');
$table->dateTime('fplannedcompletiontime')->comment('计划完工时间');
$table->string('fline', 10)->comment('生产线');
$table->integer('freceiptquantity')->comment('入库数量');
$table->dateTime('flatestreceiptdate')->nullable()->comment('最近入库日期');
$table->creatorId();
$table->createdAt();
$table->updatedAt();
$table->deletedAt();

$table->engine='InnoDB';
$table->comment('生产工单');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('production_order');
    }
};
